var express = require('express');
var JsonMessage = require('../models/JsonMessage');
var managerRouter = express.Router();
var ManagerController =require('../controller/ManagerController');
/* post users listing. */
managerRouter
    .post('/*', (req,res,next)=>{
        if(req.session.userid!=undefined) {
            next();
        }
        else{

            res.json(new  JsonMessage("3001",null,"You haven't login,jump to home page"))

        }
    })
    .post('/createNewTask', ManagerController.createNewtask)
    .post('/catManagerAccount',ManagerController.catManagerAccount)
    .post('/assignTaskToUser',ManagerController.assignTaskToUser)
    .post('/modifyManagerAccount',ManagerController.modifyManagerAccount)
    .post('/deleteATask',ManagerController.deleteATask)
    .post('/selectTodayTasks',ManagerController.selectTodayTasks)
    .post('/selectTommorrowTasks',ManagerController.selectTommorrowTasks)
    .post('/selectAllTasks',ManagerController.selectAllTasks)
    .post('/selectAllUsers',ManagerController.selectAllUsers)
    .post('/cancelTaskOfUser',ManagerController.cancelTaskOfUser)
    .post('/selectAllTasksEscTime',ManagerController.selectAllTasksEscTime)
    .post('/selectAllTasksDescTime',ManagerController.selectAllTasksDescTime)
    .post('/selectTodayTasksEscTime',ManagerController.selectTodayTasksEscTime)
    .post('/selectTodayTasksDescTime',ManagerController.selectTodayTasksDescTime)
    .post('/selectTomorrowTasksEscTime',ManagerController.selectTommorrowTasksEscTime)
    .post('/selectTomorrowTasksDescTime',ManagerController.selectTommorrowTaskDescTime)

module.exports = managerRouter;